lexer grammar AnalexGDL;

options {
  language = Java;
}

@lexer::header {
  package Practica6.Ambiguedad;
} 

@lexer::members {
  private ArrayList<String> errors = new ArrayList<String>();
  public void displayRecognitionError(String[] tokenNames, RecognitionException e) {
    String hdr = getErrorHeader(e);
    String msg = getErrorMessage(e, tokenNames);
    errors.add(hdr + " " + msg);
  }
   
  public ArrayList<String> getErrors() {
    return errors;
  }
}

fragment SALTO_LINEA:  ('\r' '\n' | '\r' | '\n');
fragment LETRA: 'a'..'z' | 'A'..'Z' | '_';
fragment DIGITO: '0'..'9';

KEYWORD_GRAPH: 'graph';

OBJECT_NODE
  : 'node'
  ;
  
OBJECT_EDGE
  : 'edge'
  ;
  
ATTR_NODE
  : 'title'
  | 'label'
  | 'borderstyle'
  ;
  
ATTR_EDGE
  : 'target'
  | 'source'
  | 'arrowstyle'
  ;
  
VALUE_NONE
  : 'none'
  ;
  
VALUE_DOTTED
  : 'dotted'
  ;
  
LEFT_BRACE: '{';
RIGHT_BRACE: '}';
COLON: ':';

BLANCO: (' ' | '\t' | SALTO_LINEA) {skip();};
COMENTARIO_LINEA : '//' (options { greedy=false;}:.)* SALTO_LINEA {skip();};
STRING: '\"' (options { greedy=false; }:.)* '\"';
  
